package initialize

import (
	"github.com/gin-gonic/gin"
	"hosptial-record/middlewares"
	"hosptial-record/router"
)

func InitRouters() *gin.Engine {
	engine := gin.New()
	// 静态资源目录设置
	engine.Static("/static", "./static")
	// 配置cors跨域
	engine.
		Use(middlewares.Cors()).
		Use(middlewares.NoLogMiddleware())
	// 健康检查的路由
	engine.GET("/health")
	ApiGroup := engine.Group("v1")
	router.InitPatientRouter(ApiGroup)
	router.InitPictureTypeRouter(ApiGroup)
	router.InitPrintRecordRouter(ApiGroup)
	router.InitUserRouter(ApiGroup)
	router.InitPictureRouter(ApiGroup)
	router.InitCommonRouter(ApiGroup)
	return engine
}
